package myapp.services;

import java.util.ArrayList;

import myapp.CTL.CategoryCTL;
import myapp.CTL.ServiceCTL;
import myapp.CTL.SubItemCTL;
import myapp.DAO.DataProvider;
import myapp.DTO.CategoryDTO;
import myapp.DTO.ServiceDTO;
import myapp.DTO.SubItemDTO;
import myapp.EnumAndConstans.Constants;

public class DbServiceHelper {
	private CategoryCTL categoryCTL;
	private ServiceCTL serviceCTL;
	private SubItemCTL subItemCTL;
	
	public DbServiceHelper(){
		DataProvider.dbBaseHost = Constants.DB_SERVER_URL +"/api/";
		categoryCTL = new CategoryCTL();
		serviceCTL = new ServiceCTL();
		subItemCTL = new SubItemCTL();
	}

	//===============CATEGORY SERVICES===================================
	public CategoryDTO getCategory(int id){
		return categoryCTL.getCategory(id);
	}
	
	public ArrayList<CategoryDTO> getAllCategories(){
		return categoryCTL.getAllCategories();
	}
	//==================================================================
	
	
	//===============SERVICES===========================================
	public ArrayList<ServiceDTO> getAllServices(){
		return serviceCTL.getAllServices();
	}
	
	public ArrayList<ServiceDTO> getServicesByKeyWord(String keyword){
		return serviceCTL.getServicesByKeyWord(keyword);
	}
	
	public ArrayList<ServiceDTO> getServicesInDistance(double yourLat, double yourLong, double distance){
		return serviceCTL.getServicesInDistance(yourLat, yourLong, distance);
	}
	
	public void AddNewService(ServiceDTO service){
		serviceCTL.AddNewService(service);
	}
	//==================================================================
	
	//===============SUBITEMS===========================================
	public void AddNewSubItem(SubItemDTO item){
		subItemCTL.AddNewSubItem(item);
	}
	
	public ArrayList<SubItemDTO> getAllSubItems(){
		return subItemCTL.getAllSubItem();
	}
	//==================================================================
}
